WDV221 Intro Javascript

Comparisons and IF Statements

Compare Numbers Assignment - Isaac Hillaker


Please complete the following exercises on this page. When complete post this page to your server. Make a link in your WDV221 homework page for this assignment.

Include a comment in each script with the exercise number and a description of what the script is supposed to do.

Using Blackboard submit this Assignment.


Value 1:

Value 2:

Result:

Instructions:

  1. Create a function called compareNumbers( ).
  2. The function will compare two numbers entered in the form above.
  3. The input fields should be validated. The validations should not allow an empty field and the input must be numeric.
  4. The function should display the largest number or "Equal" if both values are the same.
  5. The results will be displayed in a span element using the .innerHTML property.
  6. Provide a reset function that will properly clear the form between attempts.